﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UniPie
{
	/// <summary>
	/// A behavior which will be invoked when the system's current state matches the one
	/// described in the TriggerState member. When that happens, a Response is given.
	/// </summary>
	public class Behavior
	{
		public int Version = 1;
		public string Name { get; set; }
		public TriggerState TriggerState { get; set; }
		public Response Response { get; set; }

		/// <summary>
		/// Indicates that the behavior was modified since the last time it's pie menu
		/// was shown so that pie menu must be updated.
		/// </summary>
		public bool IsDirty { get; set; }

        /// <summary>
        /// Default constructor.
        /// </summary>
		public Behavior()
		{
			Name = "New Behavior";
			TriggerState = new TriggerState();
			Response = new Response();
			IsDirty = false;
		}

		/// <summary>
		/// Deep copy constructor.
		/// </summary>
		public Behavior(Behavior b)
		{
			Name = b.Name;
			TriggerState = new TriggerState(b.TriggerState);
			Response = new Response(b.Response);
			IsDirty = b.IsDirty;
		}

        /// <summary>
        /// Parametric constructor.
        /// </summary>
		public Behavior(string TheName, TriggerState TheTriggerState, Response TheResponse, bool TheIsDirty)
		{
			Name = TheName;
			TriggerState = TheTriggerState;
			Response = TheResponse;
			IsDirty = TheIsDirty;
		}
	}
}
